package com.nineclock.approve.handler;

import com.alibaba.fastjson.JSONObject;
import org.activiti.bpmn.model.Process;
import org.activiti.bpmn.model.UserTask;
import org.springframework.stereotype.Component;

/**
 * 抄送节点处理器
 */
@Component
public class CCListNodeResolver extends ProcessNodeResolver{

    private static String type = "CCList"; // 节点类型

    public boolean support(String nodeType) {
        return nodeType.equals(type);
    }

    @Override
    public void addFlowNodeToActiviti(Process process, JSONObject curNode, JSONObject nextNode) {

        UserTask userTask = new UserTask();
        userTask.setId(getNodeId(curNode));
        userTask.setName(curNode.getString("name"));
        userTask.setCategory("2"); // 抄送

        process.addFlowElement(userTask);

        newSequenceFlow(process, curNode, nextNode);
    }
}
